UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'IBB1rf8UUjIxiRhMcRDl2mDDrBKYM6YrmRO0AjKn5Ww=' 
WHERE 
  key_id = '943a779778d497fd21b093ee2e3fffa431ad62f3b452ac05561b022b9b6a18e1' 
  AND (
    token = 'IBB1rf8UUjIxiRhMcRDl2mDDrBKYM6YrmRO0AjKn5Ww=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027