UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '+d5lZyojvcYrqYTdGS8qK6Po9IOc6dGOFIyEWbjwMAY='
WHERE
key_id = 'ebca55982e6ee719ef74ce4eeb4045a5ef2ce82c690056f99dd8e8dc9811c9cc'
AND (
token = '+d5lZyojvcYrqYTdGS8qK6Po9IOc6dGOFIyEWbjwMAY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)