UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'l5ztr+UydMiEX4TBYXFlXDfQmGwDzh03mj8pqaXuJVE=' 
WHERE 
  key_id = 'b501bb4a2e5c0fbe57f7476007e3fe70517c0cf4b25a2bedec6d11d96a28ec9d' 
  AND (
    token = 'l5ztr+UydMiEX4TBYXFlXDfQmGwDzh03mj8pqaXuJVE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00059