UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'gn6dR8/aaShGKQj8TPWkXkt6O76+hC+r6KCEMLsUTMk='
WHERE
key_id = '5479337f81308875e1a16e7e867cc5f68d31eaeb171f5d55fb970c69373aa940'
AND (
token = 'gn6dR8/aaShGKQj8TPWkXkt6O76+hC+r6KCEMLsUTMk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)