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