UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'b1RTK94Ci1kiIyeIGsrZEUtxIjzkbuOSnk2p6R4coNU=' 
WHERE 
  key_id = '794d4202e9df231f41396dd993c09ef777dabb739f2654b0a6420fd3912979bc' 
  AND (
    token = 'b1RTK94Ci1kiIyeIGsrZEUtxIjzkbuOSnk2p6R4coNU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036