UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'FsphDwNfCm3QQha9hY/UXxXTHteup11vdjyJxJmjPIg=' 
WHERE 
  key_id = 'ee39bfb37831ed8172405fd69e1e88bb48680c0339d865a7e615b11ebd1d2cfe' 
  AND (
    token = 'FsphDwNfCm3QQha9hY/UXxXTHteup11vdjyJxJmjPIg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00052