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

Query time 0.00032