UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'PwL0R3f5rQfFJIH9SjTgQzk4eY1ToTV3H6hgTGUwr9U=' 
WHERE 
  key_id = '1a470ef891c3de84b0517c40200cd7ade4478245d16fd2e3e4191ccddcd0a51d' 
  AND (
    token = 'PwL0R3f5rQfFJIH9SjTgQzk4eY1ToTV3H6hgTGUwr9U=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034