UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '2xXLtLnU7AgXZHMv0HRgjxM83Lb5gHey27seiY2n2z8=' 
WHERE 
  key_id = '2a4fa7da217bdaed3b5e8fc4c2c2050d202fe0de75f90775106c9249eaf34946' 
  AND (
    token = '2xXLtLnU7AgXZHMv0HRgjxM83Lb5gHey27seiY2n2z8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042