UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'xo/v3hHaj8wkA0tZYs5YGIt6gXkUxw2KHw8N1mKXZc8='
WHERE
key_id = 'cc3a0aa4486f6a76fde10c3da27f119213e04a5f24786334474621baf6469a9a'
AND (
token = 'xo/v3hHaj8wkA0tZYs5YGIt6gXkUxw2KHw8N1mKXZc8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)