UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '0iGpAG9Dmrc5jF0rDBH3eLEvy9R3xZjOsrApRLU8+U4='
WHERE
key_id = 'cc14b0875b53ac5e7052153bc95ea4c9f0b639edc80d74cbb3b6897ef2693099'
AND (
token = '0iGpAG9Dmrc5jF0rDBH3eLEvy9R3xZjOsrApRLU8+U4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)