UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'VlBbsArfR5BjggNkghYNqe/Bwps0KFOUuHKBHAHOIQs='
WHERE
key_id = 'a39e957bd28bbfda1480c1514217dd5ab3a5bb8e3b95c10f736da44486890d19'
AND (
token = 'VlBbsArfR5BjggNkghYNqe/Bwps0KFOUuHKBHAHOIQs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)