UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '22tcBDlSdaZzSz+cYB7ulKTQjUNOZG318VSFUFP9K+g='
WHERE
key_id = '0f42b66d87b55c3ff96689d533831df79265ba64536df9fcef09d248414c11c5'
AND (
token = '22tcBDlSdaZzSz+cYB7ulKTQjUNOZG318VSFUFP9K+g='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)