UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'kI5Ny/ZINMz6Nwm2kDiUbIMLywKII6HzmKMSjPIM54o=' 
WHERE 
  key_id = 'edd8e22a9b706a921511857215c03ce77250291a72f3661d3a6ee04d4b54a227' 
  AND (
    token = 'kI5Ny/ZINMz6Nwm2kDiUbIMLywKII6HzmKMSjPIM54o=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00065