UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'IUkZy4qtzrRGK3wSctTNevHisiqQdeQh9zaH46VnNXE=' 
WHERE 
  key_id = '1bad12aab8cea5fb1bb4a91f8838b1cc6aa6d34493d63de9a41d3820684de04b' 
  AND (
    token = 'IUkZy4qtzrRGK3wSctTNevHisiqQdeQh9zaH46VnNXE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037