UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'g3fbOHYm74Eu/cv17T857ZGn1+s5ngEO+8MyCsQzm0k='
WHERE
key_id = 'a07e5297a68c0b24df06263f280b8d08037103b6a848e301f23ff62da6dc803b'
AND (
token = 'g3fbOHYm74Eu/cv17T857ZGn1+s5ngEO+8MyCsQzm0k='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)