UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ab5TJv0z2QCzHf2H/ncA/amKxgd62cLcuiU48dG1UuI='
WHERE
key_id = '42062bf478291fa8d06562300fecd012de825c34ba38a302682d3a7cb9658b84'
AND (
token = 'ab5TJv0z2QCzHf2H/ncA/amKxgd62cLcuiU48dG1UuI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)