UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'A5zJBY5jtmut7Bn8B9UVjJ7j2Nb5S50HpLvngZ2ffxE=' 
WHERE 
  key_id = '3f8f4fcddbb6f096b54081c215a9703575a3f60c44657b8c3b8335415ffefd8d' 
  AND (
    token = 'A5zJBY5jtmut7Bn8B9UVjJ7j2Nb5S50HpLvngZ2ffxE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039