UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'kUM2TRr9YVEbOJlNidGggxL2N7mgcuK8O3aeMsR1A+0='
WHERE
key_id = '518c460bd6409936330db7cc6ab6ec8a6ee664cbefdcbf9ca46ac760d2c245b0'
AND (
token = 'kUM2TRr9YVEbOJlNidGggxL2N7mgcuK8O3aeMsR1A+0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)