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