UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'F2swhGJ+eeH1tNDwrit5/AG9gf79SrPaBS+TvBv3pBs=' 
WHERE 
  key_id = '9739d4a2527d49a6e60ffeced2e6a4cf1392b33fe3f336ea00f192db1fcc616c' 
  AND (
    token = 'F2swhGJ+eeH1tNDwrit5/AG9gf79SrPaBS+TvBv3pBs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039