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