UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'OBIlP/Tg7AduAb1Of33bSVPqdBlzMKjYzCeRN0B5qD4='
WHERE
key_id = 'bf827123f8b734b787e1c34a1fdaac31d0dfa4309cfa98ae673b5fbce7abe20e'
AND (
token = 'OBIlP/Tg7AduAb1Of33bSVPqdBlzMKjYzCeRN0B5qD4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)