UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '1aguhMPW6aKMUmtDjKCFSY04wFax3GOHjgpFyCtaFY0='
WHERE
key_id = 'e6303b6c0556ce257418b95bd48bfd23d1c2e3ad6171d61d44609883887667b9'
AND (
token = '1aguhMPW6aKMUmtDjKCFSY04wFax3GOHjgpFyCtaFY0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)