UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '0NMfdDHlNT/bXqjF/BsIUNd7bGSwwDwvHaRUN+zVZUU=' 
WHERE 
  key_id = '820f904d05547ee0a2167142be6cbcef6f4de7002323e4d11d552a100610fff8' 
  AND (
    token = '0NMfdDHlNT/bXqjF/BsIUNd7bGSwwDwvHaRUN+zVZUU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030