UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'SqHGfwNNIFsx7q8NuM8TNYE+ZQpskvRZk3NGGvmyf9Q='
WHERE
key_id = '3a31ff8508074255e1384ca379bb41664c3c5126be7842efc63070f33b47aaa5'
AND (
token = 'SqHGfwNNIFsx7q8NuM8TNYE+ZQpskvRZk3NGGvmyf9Q='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)