UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'k2niRNRD12n8oTI2nD24Uyi2lqxQ8LHC+14Aj/9hLjM=' 
WHERE 
  key_id = 'b41c388ebe710217dd52ec3e91e8b24a4bc8834a1dec497678a70048b560497a' 
  AND (
    token = 'k2niRNRD12n8oTI2nD24Uyi2lqxQ8LHC+14Aj/9hLjM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035