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