UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'qFeIlhnV38J2bDIS0Popq0N1R2PtPH7cOt20v7chjJg=' 
WHERE 
  key_id = '4ebda07cf1f1e22bdc6a505c6dbc541129c7227550f64f087facb2d91aa32c27' 
  AND (
    token = 'qFeIlhnV38J2bDIS0Popq0N1R2PtPH7cOt20v7chjJg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040