UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'cA3d3Zt8utddHzYD8+i0YMa1UGzlxk7yoLudwFkOiEI='
WHERE
key_id = '269669f856a211ab5caeba03fe0cd7470f698a95a2c4e763306a1fc0af57cfb1'
AND (
token = 'cA3d3Zt8utddHzYD8+i0YMa1UGzlxk7yoLudwFkOiEI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)