UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '0YcAlgopMz3V+RC1JCfn2HusB60TGAXLxlIQJp1t71s=' 
WHERE 
  key_id = '617ba3dbf53e63de39a1952bde6857afef66e98aa3358e408213b2ec4595b19c' 
  AND (
    token = '0YcAlgopMz3V+RC1JCfn2HusB60TGAXLxlIQJp1t71s=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00017