UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'nzV4KW/B5/3JVy112RZtW36+TlxNSCv1EYqF3/Io2ao='
WHERE
key_id = 'fd5bdde61127f523bc931dc3ae97117a87f1bcfce1df91ba5c65974bc8906627'
AND (
token = 'nzV4KW/B5/3JVy112RZtW36+TlxNSCv1EYqF3/Io2ao='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)