UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'EfgfFO3GR7QwyInCRG1R52SAGNUyfmQ7FYh0J9Cscms='
WHERE
key_id = 'd2e68b0a9a118f337cfb6141eef7b5234414ea2829dcd162d9ef8e970fa3e010'
AND (
token = 'EfgfFO3GR7QwyInCRG1R52SAGNUyfmQ7FYh0J9Cscms='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)