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